/*
 * Copyright (c) 2018-2021. data2viz sàrl.
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 */

package com.gitee.wsl.common.ui.symbol.generator


import androidx.compose.ui.graphics.Path
import com.gitee.wsl.common.ui.symbol.generator.curve.Basis
import com.gitee.wsl.common.ui.symbol.generator.curve.BasisClosed
import com.gitee.wsl.common.ui.symbol.generator.curve.BasisOpen
import com.gitee.wsl.common.ui.symbol.generator.curve.Bundle
import com.gitee.wsl.common.ui.symbol.generator.curve.Cardinal
import com.gitee.wsl.common.ui.symbol.generator.curve.CardinalClosed
import com.gitee.wsl.common.ui.symbol.generator.curve.CardinalOpen
import com.gitee.wsl.common.ui.symbol.generator.curve.CatmullRom
import com.gitee.wsl.common.ui.symbol.generator.curve.CatmullRomOpen
import com.gitee.wsl.common.ui.symbol.generator.curve.Linear
import com.gitee.wsl.common.ui.symbol.generator.curve.LinearClosed
import com.gitee.wsl.common.ui.symbol.generator.curve.MonotoneX
import com.gitee.wsl.common.ui.symbol.generator.curve.MonotoneY
import com.gitee.wsl.common.ui.symbol.generator.curve.Natural
import com.gitee.wsl.common.ui.symbol.generator.curve.Step
import com.gitee.wsl.common.ui.symbol.generator.curve.StepAfter
import com.gitee.wsl.common.ui.symbol.generator.curve.StepBefore
import com.gitee.wsl.common.ui.symbol.generator.curve.CatmullRomClosed

val PathBuilder.Companion.Curve: Curves
    get() = Curves

interface Curve {
     val path: Path
     fun areaStart()
     fun areaEnd()
     fun lineStart()
     fun lineEnd()
     fun point(x: Float, y: Float)
}

// TODO maybe give an alias name for a "(Path) -> Curve" object
 object Curves {
     val basis: (Path) -> Basis = { path: Path -> Basis(path) }
     val basisClosed: (Path) -> BasisClosed = { path: Path -> BasisClosed(path) }
     val basisOpen: (Path) -> BasisOpen = { path: Path -> BasisOpen(path) }
     val bundle: (Path) -> Bundle = { path: Path -> Bundle(path) }
     val cardinal: (Path) -> Cardinal = { path: Path -> Cardinal(path) }
     val cardinalClosed: (Path) -> CardinalClosed = { path: Path -> CardinalClosed(path) }
     val cardinalOpen: (Path) -> CardinalOpen = { path: Path -> CardinalOpen(path) }
     val catmullRom: (Path) -> CatmullRom = { path: Path -> CatmullRom(path) }
     val catmullRomClosed: (Path) -> CatmullRomClosed = { path: Path -> CatmullRomClosed(path) }
     val catmullRomOpen: (Path) -> CatmullRomOpen = { path: Path -> CatmullRomOpen(path) }
     val linear: (Path) -> Linear = { path: Path -> Linear(path) }
     val linearClosed: (Path) -> LinearClosed = { path: Path -> LinearClosed(path) }
     val monotoneX: (Path) -> MonotoneX = { path: Path -> MonotoneX(path) }
     val monotoneY: (Path) -> MonotoneY = { path: Path -> MonotoneY(path) }
     val natural: (Path) -> Natural = { path: Path -> Natural(path) }
//    val radialLinear            = {path: Path -> RadialLinear(path) }
//    val radialBasis             = {path: Path -> Radial(path, Basis(path)) }
//    val radialLinearClosed      = {path: Path -> Radial(path, LinearClosed(path)) }
     val step: (Path) -> Step = { path: Path -> Step(path) }
     val stepBefore: (Path) -> StepBefore = { path: Path -> StepBefore(path) }
     val stepAfter: (Path) -> StepAfter = { path: Path -> StepAfter(path) }
}

/*
 object areas {
     val default: (Path) -> Linear = { path: Path -> Linear(path) }
     val basis: (Path) -> Basis = { path: Path -> Basis(path) }
}
*/
